package com.xzk.ExpressInnWeb.service;

import com.xzk.ExpressInnWeb.bean.User;
import com.xzk.ExpressInnWeb.dao.BaseUserDao;
import com.xzk.ExpressInnWeb.dao.daoImp.UserDaoMySQL;

import java.util.Date;
import java.util.List;
import java.util.Map;

public class UserService {
    
    private static BaseUserDao dao = new UserDaoMySQL();
    
    public static User findUserByID(int id) {
        return dao.findUserByID(id);
    }
    
    public static Map<String, Integer> consoleUser() {
        return dao.consoleUser();
    }

    public static List<User> findAllUsers(boolean split, int offset, int limit) {
        return dao.findAllUsers(split, offset, limit);
    }

    public static User findUserByPhoneNum(String userphone) {
        return dao.findUserByPhoneNum(userphone);
    }

    public static boolean insertUser(User user) {
        return dao.insertUser(user);
    }

    public static boolean updateUser(int id, User newUser) {
        return dao.updateUser(id, newUser);
    }

    public static boolean deleteUser(int id) {
        return dao.deleteUser(id);
    }

    public static void updateLoginTime(String userphone, Date date) {
        dao.updateLoginTime(userphone, date);
    }

    public static boolean login(String userphone, String password) {
        return dao.login(userphone, password);
    }
}
